<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <link rel="stylesheet" type="text/css" href="../resources/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../resources/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../resources/css/grumble.css">

    <script type="text/javascript" src="../resources/scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../resources/scripts/bootstrap.js"></script>
    <script type="text/javascript" src="../resources/scripts/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="../resources/scripts/bootstrap-datetimepicker.zh-CN.js"></script>
    <script type="text/javascript" src="../resources/scripts/jquery.grumble.min.js"></script>
    <script type="text/javascript" src="../resources/scripts/zhBase.js"></script>
    <script type="text/javascript" src="../resources/scripts/zhForm.js"></script>
    <script type="text/javascript" src="../resources/scripts/exam/editTestAnswer.js"></script>
</head>
<BODY class="mian_bg">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
    <TR height=28>
        <TD class="addr_td">&nbsp;&nbsp;<img src="/sys/resources/images/addr_icon.png">&nbsp;当前位置: 学习>修改考试题目</TD>
    </TR>
    <TR>
        <TD bgColor=#7ca600 height=1></TD>
    </TR>
    <TR>
        <TD bgColor=#8ebe00 height=1></TD>
    </TR>
</TABLE>

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">修改考试题目</h3>
        </div>
        <div class="panel-body">
            <form action="/sys/test/editData.do" id="formId" class="form-horizontal" role="form">

                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="name" class="col-sm-3 control-label">所属学习内容</label>

                            <div class="col-sm-9">
                                <input name="id" type="hidden" value="${test.id}">
                                <input name="issingle" type="hidden" value="${test.issingle}">
                                <input type="hidden" value="" name="data" id="data"/>
                                <input type="hidden" value="" id="deletetestIds" name="deleteaIds"/>

                                <input name="name" readonly="readonly" type="text" class="form-control"
                                       id="name" value="${test.contentTitle}">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-8">
                        <div class="form-group">
                            <label for="title" class="col-sm-3 control-label">题目名称</label>

                            <div class="col-sm-9">
                                <textarea id="title" name="title" class="form-control" notNull="true"
                                          rows="3">${test.title}</textarea>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-2">
                    </div>
                    <div class="col-xs-4">
                        <div style="margin-bottom: 20px">
                            <button type="button" id="btadddid" class="btn btn-success btn-block">添加题目及答案</button>
                        </div>
                    </div>
                    <div class="col-xs-2">
                    </div>
                </div>

                <c:choose>
                    <c:when test="${test.issingle=='1'}">
                        <c:forEach var="item" items="${listExamAnswer}" varStatus="status">
                            <c:if test="${item.isright=='1'}">
                                <div class="row rowdiv" id="rowDiv${status.count}">
                                    <div class="col-xs-2"></div>
                                    <div class="col-xs-4">
                                        <div class="form-group"><label for="textarea${status.count}"
                                                                       class="col-sm-3 control-label">题目答案</label>

                                            <div class="col-sm-9">
                                                <input type="hidden" value="${item.id}" id="examanswerid${status.count}" name="examanswerid${status.count}"/>
                                                <textarea name="textarea${status.count}"
                                                                            class="form-control"
                                                                            notnull="true"
                                                                            id="textarea${status.count}"
                                                                            rows="3">${item.content}</textarea></div>
                                        </div>
                                    </div>
                                    <div class="col-xs-2"><label class="radio-inline "> <input name="right" type="radio"
                                                                                               notnull="true"
                                                                                               checked="checked"
                                                                                               value="input${status.count}">
                                        正确答案
                                    </label></div>
                                    <div class="col-xs-2">
                                        <button type="button" value="rowDiv${status.count}"
                                                name="rowDiv${status.count}" class="btn btn-danger"
                                                onclick="deleteRowDiv('rowDiv${status.count}')">删除
                                        </button>
                                    </div>
                                    <div class="col-xs-2"></div>
                                </div>
                            </c:if>
                            <c:if test="${item.isright=='0'}">
                                <div class="row rowdiv" id="rowDiv${status.count}">
                                    <div class="col-xs-2"></div>
                                    <div class="col-xs-4">
                                        <div class="form-group"><label for="textarea${status.count}"
                                                                       class="col-sm-3 control-label">题目答案</label>

                                            <div class="col-sm-9">
                                                <input type="hidden" value="${item.id}" id="examanswerid${status.count}" name="examanswerid${status.count}"/>
                                                <textarea name="textarea${status.count}"
                                                                            class="form-control"
                                                                            notnull="true"
                                                                            id="textarea${status.count}"
                                                                            rows="3">${item.content}</textarea></div>
                                        </div>
                                    </div>
                                    <div class="col-xs-2"><label class="radio-inline "> <input name="right" type="radio"
                                                                                               notnull="true"
                                                                                               value="input${status.count}">
                                        正确答案
                                    </label></div>
                                    <div class="col-xs-2">
                                        <button type="button" value="rowDiv${status.count}"
                                                name="rowDiv${status.count}" class="btn btn-danger"
                                                onclick="deleteRowDiv('rowDiv${status.count}')">删除
                                        </button>
                                    </div>
                                    <div class="col-xs-2"></div>
                                </div>
                            </c:if>
                        </c:forEach>
                    </c:when>
                    <c:otherwise>
                        <c:forEach var="item" items="${listExamAnswer}" varStatus="status">
                            <c:if test="${item.isright=='1'}">
                                <div class="row rowdiv" id="rowDiv${status.count}">
                                    <div class="col-xs-2"></div>
                                    <div class="col-xs-4">
                                        <div class="form-group"><label for="textarea${status.count}"
                                                                       class="col-sm-3 control-label">题目答案</label>

                                            <div class="col-sm-9">
                                                <input type="hidden" value="${item.id}" id="examanswerid${status.count}" name="examanswerid${status.count}"/>
                                                <textarea name="textarea${status.count}"
                                                                            class="form-control"
                                                                            notnull="true"
                                                                            id="textarea${status.count}"
                                                                            rows="3">${item.content}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xs-2">
                                        <div class="checkbox"><label> <input name="input${status.count}" minnum="0"
                                                                             maxnum="2"
                                                                             checked="checked"
                                                                             value="input${status.count}"
                                                                             type="checkbox">
                                            正确答案 </label></div>
                                    </div>
                                    <div class="col-xs-2">
                                        <button type="button" value="rowDiv${status.count}" name="rowDiv${status.count}"
                                                class="btn btn-danger"
                                                onclick="deleteRowDiv('rowDiv${status.count}')">删除
                                        </button>
                                    </div>
                                    <div class="col-xs-2"></div>
                                </div>
                            </c:if>
                            <c:if test="${item.isright=='0'}">
                                <div class="row rowdiv" id="rowDiv${status.count}">
                                    <div class="col-xs-2"></div>
                                    <div class="col-xs-4">
                                        <div class="form-group"><label for="textarea${status.count}"
                                                                       class="col-sm-3 control-label">题目答案</label>

                                            <div class="col-sm-9">
                                                <input type="hidden" value="${item.id}" id="examanswerid${status.count}" name="examanswerid${status.count}"/>
                                                <textarea name="textarea${status.count}"
                                                                            class="form-control"
                                                                            notnull="true"
                                                                            id="${status.count}"
                                                                            rows="3">${item.content}</textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-xs-2">
                                        <div class="checkbox"><label> <input name="input${status.count}" minnum="0"
                                                                             maxnum="2"
                                                                             value="input${status.count}"
                                                                             type="checkbox">
                                            正确答案 </label></div>
                                    </div>
                                    <div class="col-xs-2">
                                        <button type="button" value="rowDiv${status.count}" name="rowDiv${status.count}"
                                                class="btn btn-danger"
                                                onclick="deleteRowDiv('rowDiv${status.count}')">删除
                                        </button>
                                    </div>
                                    <div class="col-xs-2"></div>
                                </div>
                            </c:if>
                        </c:forEach>
                    </c:otherwise>
                </c:choose>
                <c:if test="${!empty listExamAnswer}">
                    <div class="row" id="rowButton">
                        <div class="col-xs-2">
                        </div>
                        <div class="col-xs-4">
                            <button type="button" id="btnid" onclick="submitForm();" class="btn btn-success btn-block">提交</button>
                        </div>
                        <div class="col-xs-2">
                        </div>
                    </div>
                </c:if>
            </form>
        </div>
    </div>
</div>
</body>
</html>
